package system;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class database {

	public static void main(String[] args) {
		Connection con;
	    Statement sql;
	    ResultSet rs=null;
	    try{
	    	Class.forName("com.mysql.cj.jdbc.Driver");
	    	}
	    catch(Exception e){System.out.print(e);}
   
        try{
		String uri = "jdbc:mysql://127.0.0.1:3306/test";
		String user = "root";
		String password = "1234";
		con=DriverManager.getConnection(uri,user,password);
		sql=con.createStatement();
		rs=sql.executeQuery("select * from test1");
		while (rs.next()) {
			System.out.print((String)(rs.getString(1)));
		}

		con.close();
	    } catch(SQLException e1){System.out.print(e1);}

	}

}
